package com.frame.service.impl;

import com.base.dao.DAO;
import com.base.util.PageData;
import com.frame.service.MenuManager;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by lee on 2016/6/24.
 */
@Service("menuService")
public class MenuServiceImpl implements MenuManager {

    @Resource(name = "daoSupport")
    private DAO daoSupport;


    public PageData getMenuByMenuID(PageData pd) {
        PageData menu = new PageData();
        try {
            menu = (PageData) daoSupport.findForObject("MenuMapper.getMenuByMenuID",pd);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return menu;
    }

    public List<PageData> getMenuByParentID(PageData pd) {
        List<PageData> menuList = new ArrayList<PageData>();
        try {
            menuList = (List<PageData>) daoSupport.findForList("MenuMapper.getMenuByParentID",pd);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return menuList;
    }
}
